<script>
import TableVue from "@/components/TableVue/";
export default {
  name: "AegleTable",
  components: {
    TableVue,
  },
  props: {
    schema: {
      type: Object,
      default: null,
    },
  },
  created() {
    if (this.schema && this.schema.api) {
      // mock api
      setTimeout(() => {
        this.schema.data.list = [{ name: "萨达", age: 22, sex: "男" }];
        this.schema.data.column = [
          { prop: "name", label: "名字" },
          { prop: "age", label: "年龄" },
          { prop: "sex", label: "性别" },
        ];
      }, 100);
    }
  },
  render() {
    if (this.schema) {
      const { list, column } = this.schema.data;

      return <table-vue data={list} column={column} {...this.schema.props} />;
    }
  },
};
</script>

<style>
</style>
